|
- // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
- import type { NextApiRequest, NextApiResponse } from 'next'
- import {Game, getAvailableGames} from '../../../utils/games';
-
- export default async function handler(
- req: NextApiRequest,
- res: NextApiResponse<Game>
- ) {
- const gameManifests = await getAvailableGames();
- const game = gameManifests.find((g) => g.id === req.query.id);
- if (game) {
- res.json(game)
- return
- }
- res.status(404)
- }
|